package operation;

import book.BookList;

import java.util.Scanner;

public class BorrowOperation implements IOPeration {
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int current = bookList.getUsedSize();
        for (int i = 0; i < current; i++) {
            if (name.equals(bookList.getBook(i).getName())) {
                bookList.getBook(i).setBorrowed(true);
                System.out.println("借阅成功");
                return;
            }
        }
        System.out.println("未找到该书名");
    }
}
